package com.xinfu.newproject.ui.carFee.add_parking;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.xinfu.newproject.R;
import com.xinfu.newproject.base.BaseActivity;
import com.xinfu.newproject.bean.park_bean.bean.GetMonthCarListBean;
import com.xinfu.newproject.widget.picture.ViewPagerActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ParkingDetailActivity extends BaseActivity {


    @BindView(R.id.activity_month_park_community)
    TextView communityTv;

    @BindView(R.id.activity_month_park_car)
    TextView carTv;

    @BindView(R.id.activity_month_park_project)
    TextView projectTv;

    @BindView(R.id.activity_month_park_name)
    TextView nameTv;

    @BindView(R.id.activity_month_park_phone)
    TextView phoneTv;

    @BindView(R.id.activity_month_park_status)
    TextView statusTv;

    @BindView(R.id.activity_month_park_img)
    ImageView parkIv;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_month_park_detail);
        ButterKnife.bind(this);
        registerBack();
        setActivityTitle("月卡车详情");
        initViewBind();
        initLisener();

    }

    GetMonthCarListBean.ResultBean item;

    private void initViewBind() {
        item = new Gson().fromJson(getIntent().getExtras().getString("response"), GetMonthCarListBean.ResultBean.class);
        communityTv.setText(item.getParkName());
        carTv.setText(item.getCarId());
        projectTv.setText(item.getRoomName());
        nameTv.setText(item.getOwner());
        phoneTv.setText(item.getMobile());
        statusTv.setText(item.getCheckStatusName());
        Glide.with(this).load(item.getImages()).asBitmap().into(parkIv);
    }

    private void initLisener() {
        parkIv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Bundle bundle1 = new Bundle();
                bundle1.putString("picture", item.getImages());
                bundle1.putInt("position", 1);
                startIntentActivityAnim(ViewPagerActivity.class, parkIv, bundle1);
            }
        });
    }
}
